package g2RedBlackTree;
/*
 * Node class who contains the words from the dictionnary 
 */
public class RedBlackNodeData<T1,T2> extends MyNode<T1>{
	
    public T2 wordsAplhabeticOrdered;
	
	//first node constructor 
	//public RedBlackNode(){
	//	this((T1)(-1), null, null);
	//}
	
	// default constructors, use when it's the first  
	public RedBlackNodeData( T1 theSequenceNumber ) {
		this( theSequenceNumber, null );
	}

	// constructor use when you want to add a node to the tree
	public RedBlackNodeData( T1 theSequenceNumber, T2 Data ) {
		super(theSequenceNumber);
		//sequenceNumber  = theSequenceNumber;
		wordsAplhabeticOrdered = Data;
	}
	
	// constructor use when you want to add a node to the tree
	public RedBlackNodeData( RedBlackNodeData<T1,T2> redBlack, RedBlackNodeData<T1,T2> lt, RedBlackNodeData<T1,T2> rt ) {
		super(redBlack.sequenceNumber);
		left     = lt;
		right    = rt;		
		this.wordsAplhabeticOrdered = redBlack.wordsAplhabeticOrdered;
	}
	
	//add a word in the node
    public T2 getDataObject(){
    	return getWords(); 
    }
	public T2 getWords(){
		return this.wordsAplhabeticOrdered;
	}
	public T1 getKey(){
		return this.sequenceNumber;
	}
	public String toString(){
		String result = ""+this.sequenceNumber+"["
						+((this.color==0)?"Red":"Black") +","+levelLeft+", "+levelRight+"]=>";
		
		return result;
	}
}
